package com.shkco.xbjcc.fallback;

import com.shkco.exception.GlobalExceptionCode;
import com.shkco.result.JSONResult;
import com.shkco.xbjcc.feign.UserService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserServiceFallbackFactory implements FallbackFactory<UserService> {

    @Override
    public UserService create(Throwable throwable) {
        return new UserService() {

            @Override
            public JSONResult get(Long id) {
                return JSONResult.error(GlobalExceptionCode.ERROR);
            }
        };
    }
}
